<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:autocomplete="http://java.sun.com/jsf/composite/autocomplete">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">

                <p:panel  >

                    <f:facet name="header" >
                        <h:form >
                            <p:outputLabel value="Add Staff Signature" ></p:outputLabel>
                            <p:commandButton ajax="false" value="Back" action="#{webUserController.backToViewUsers()}" >
                            </p:commandButton>
                        </h:form>
                    </f:facet>




                    <h:panelGrid columns="2" styleClass="alignTop" >

                        <p:panel header="Add New Signature" >

                            <h:form enctype="multipart/form-data" >
                                <h:panelGrid columns="2" >
                                    <h:outputLabel value="Name" >
                                    </h:outputLabel>
                                    <autocomplete:completeStaff value="#{staffController.current}"/>

                                    <p:fileUpload value="#{staffImageController.file}" mode="simple"/>
                                    <p:commandButton ajax="false" id="btnSave" value="Save" action="#{staffImageController.saveSignature()}"/>

                                    <p:defaultCommand target="btnSave"/>


                                </h:panelGrid>
                            </h:form>

                        </p:panel>

                        <h:form >
                            <p:panel >
                                <f:facet name="header" >
                                    <p:outputLabel value="Current Signature" ></p:outputLabel>
                                    <p:commandButton ajax="false" id="btnSave2" value="Remove" action="#{staffImageController.removeSignature()}"/>
                                </f:facet>
                                <div >
                                    <p:graphicImage cache="false"  value="#{staffImageController.signatureFromStaffController}" >
                                    </p:graphicImage>
                                </div>
                                <p:graphicImage cache="false"  value="#{staffImageController.signatureFromStaffController}" >
                                </p:graphicImage>
                            </p:panel>

                        </h:form>

                    </h:panelGrid>










                </p:panel>


            </ui:define>


        </ui:composition>

    </h:body>
</html>
